﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace PDNPAS
{
    public partial class frmLogin : DevExpress.XtraEditors.XtraForm
    {
        public frmLogin()
        {
            InitializeComponent();
        }

        private void btnReset_Click(object sender, EventArgs e)
        {
            txtUserID.Text = "";
            txtUserPassword.Text = "";
            lblLoginTip.Text = "请输入用户编号和密码！";
        }

        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (txtUserID.Text == "admin" && txtUserPassword.Text == "1234")
            {
                this.DialogResult = DialogResult.OK;
                User user1 = new User();
                user1.UserName = "lyl";
                StaticVariables.user = user1;
            }
            else
            {
                lblLoginTip.Text = "用户名或密码错误";
            }
        }

        private void frmLogin_Load(object sender, EventArgs e)
        {
            txtUserID.Focus();
        }

        private void txtUserPassword_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                this.btnLogin_Click(btnLogin, null); //在TextEdit按Enter键就执行btnLogin的单击事件
            }
        }


    }
}